<template>
  <div class="newslist">
   <van-card
      :title="item.title"
      :thumb="item.img_url"
      v-for="item in newslist"
      :key="item.id"
      @click="goNewsInfo(item.id)"
    >
      <div slot="price">
        <span>{{item.add_time}}</span>
      </div>
      <div slot="num">
        <span>点击{{item.click}}次</span>
      </div>
    </van-card>
  </div>
</template>
<script>
export default {
  data: () => ({
    newslist: []
  }),
  created () {
    this.getnewslist()
  },
  methods: {
    async getnewslist () {
      const {
        data: { status, message }
      } = await this.$axios.get('api/getnewslist')
      if (status !== 0) this.$Toast(message)
      this.newslist = message
    },
    goNewsInfo (id) {
      this.$router.push('/home/newsinfo/' + id)
    }
  }
}
</script>
<style lang="less" scoped>
.newslist{
  .van-card{
    height: 72px;
  }
  .van-card__thumb{
    height: 55px;
  }
  .van-card__bottom{
    margin-top: 20px;
  }
}
</style>
